<template>
    <div id="product">
        product
        <ul class="allProduct">
            <li v-for="productItem in myData_products" class="productItem">
                <router-link :to="'/detail/'+productItem._id">   
                    <div class="picBox">
                        <img alt="productPicture" :src="'http://localhost:3000/'+productItem.picture"/>
                    </div>
                    <div class="textBox">
                        <p>{{productItem.title}}</p>
                        <p><span class="price">￥{{productItem.price}}</span><span class="comments">{{productItem.comments}}&nbsp;人已评论</span><span class="more">...</span></p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
import "./product.css";
import {mapMutations,mapGetters,mapActions} from "vuex";
export default {
    data(){
        return{

        }
    },
    methods:{
        ...mapActions(["reqProducts"])
    },
    computed:{ 
      ...mapGetters(["myData_products"])
    },
    created(){
        this.changeCurMode('商品')
    },
    created(){
        console.log(111);
        this.reqProducts();
    }
}
</script>